// components/grid/grid.js
Component({
    relations: {
        "../grid-item/grid-item": {
            type: "child"
        }
    },
    options: {
        multipleSlots: true
    },
    /**
     * 组件的属性列表
     */
    properties: {
        title: String,
        extend: String,
        rowNum: {
            type: Number,
            value: 3,
        }
    },

    /**
     * 组件的初始数据
     */
    data: {
        gridItems: [],
    },
    lifetimes: {
        ready(){
            this.getGridItems();
        }
    },

    /**
     * 组件的方法列表
     */
    methods: {
        handleExtend(){

        },
        getGridItems(){
            const items = this.getRelationNodes("../grid-item/grid-item")
            // console.log(items);
            const gridItems = items.map((item, index)=>{
                return {
                    index
                }
            })
            // console.log(gridItems);
            this.setData({
                gridItems: gridItems
            })
        }
    }
})
